import Vue from "vue"
import { Observer } from "mobx-vue"
import Component from "vue-class-component"
import { outLogin } from "src/utils/axios"
import axios from 'axios';
import { imagesOssPrefix } from "src/utils/ztbase";
require('./xheader.scss');


@Observer
@Component
export default class CsjIndex extends Vue {
  ModelData;
  logoUrl: any = "https://hongsen-jx-zhjd.oss-cn-hangzhou.aliyuncs.com/upload/logo.png";
  defaultAvatar: any = 'https://sizex-prod.oss-accelerate.aliyuncs.com/size-biz/default-avatar.png';
  userMsg: any = {}
  truename:any = ''
  async mounted() {
    let vm:any = this;
    let xwindow: any = window;
    vm.truename = xwindow.localStorage.getItem("truename");
  }
  //是否展示子菜单
  isShowMenu(index) {
    let vm: any = this;
    for (let i = 0; i < vm.ModelData.xLeftTitle.length; i++) {
      if (index !== i) {
        vm.$set(vm.ModelData.xLeftTitle[i], 'isShow', false);

      } else {
        vm.$set(vm.ModelData.xLeftTitle[index], 'isShow', !vm.ModelData.xLeftTitle[index].isShow);
      }

    }

  }
  //跳转链接
  menuItemLocation(url) {
    let vm = this;
    if (url == vm.ModelData.xNewPath) {
      return
    }
    vm.$router.push(url);
  }
  //退出登录方法
  async xout() {
    let vm:any = this;
    window.localStorage.removeItem('sessionId');
    window.localStorage.removeItem('nickname');
    window.localStorage.removeItem('truename');
    window.localStorage.removeItem('avatar');
    window.localStorage.removeItem('street_code');
    vm.$router.push('/'); 
  }
  // 图片补全前缀
  imagePrefix(url, zoomScale) {
    return imagesOssPrefix(url, zoomScale)
  }
}